﻿using System.Collections;
using BaseSyntax.Collection.AnimalBase;

namespace BaseSyntax.Collection.CollecttionBaseTest
{
	public class Animals:CollectionBase
	{
		public Animals()
		{
			
		}
		
		//List 通过IList接口访问项
		public void add(Animal newAnimal)
		{
			List.Add(newAnimal);
		}

		public void remove(Animal animal)
		{
			List.Remove(animal);
		}
		
		// InnerList 存储项的ArrayList对象
		
		
		
		// Ienumrable 
		public void enumrableTest()
		{
			foreach (Animal animal in InnerList)
			{
				animal.Feed();
			}
		}

		public IEnumerator GetEnumerator()
		{
			foreach (Animal animal in List)
			{
				yield return animal;
			}
		}
	}
}